#include <yaml-cpp/yaml.h>


#include <iostream>

#include "ExternalBallisticsSimulator.h"
#include "InternalBallisticsSimulator.h"
int main() {



    // Set simulation parameters
    int functionFlag;
    int paramFlag;
    std::string result;
    while (1) {
        char input;
        std::cout << "选择功能:1.计算内弹道;2.计算外弹道(1/2): ";
        std::cin >> input;
        if (input == '1') {
            functionFlag = 1;
            break;
        } else if (input == '2') {
            functionFlag = 2;
            break;
        }
    }
    while (1) {
        char input;
        std::cout << "是否使用yaml文件中参数?(Y/N): ";
        std::cin >> input;
        if (input == 'Y' || input == 'y') {
            paramFlag = 1;
            break;
        } else if (input == 'N' || input == 'n') {
            paramFlag = 0;
            break;
        }
    }

    if (functionFlag == 1) {
        double m_timeStep = 0.00001;  //模拟的时间粒度为0.01ms
        int m_outputInterval = 100;   //默认每隔100步输出一次
        InternalBallisticsSimulator simulator(m_timeStep, m_outputInterval);
        if (paramFlag == 1) {
            //读取params.yaml
            simulator.initializefromyaml("../params/Internalparams.yaml");
        } else {
            simulator.initialize();
        }
        result = simulator.runSim();
    } else {
        ExternalBallisticsSimulator simulator;
        if (paramFlag == 1) {
            //读取params.yaml
            simulator.initializefromyaml("../params/Externalparams.yaml");
        } else {
            simulator.initialize();
        }
        result = simulator.runSim();
    }

    // std::cout << result << std::endl;
    return 0;
}
